package com.example.truthordare;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.RatingBar;

public class Rate extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_rate);
		final RatingBar rt1=(RatingBar) findViewById(R.id.ratingBar1);
		Button btok=(Button) findViewById(R.id.rate_conti);
		
		btok.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				int a=(int) rt1.getRating();
				final int send =a;
				Bundle sendBundle = new Bundle();
				sendBundle.putInt("make", send);
				Log.i("Rate send", ""+send);
				Intent i = new Intent();
				i.putExtras(sendBundle);
				setResult(RESULT_OK,i);
				finish();
				
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.rate, menu);
		return true;
	}

}
